package nyist.media.vo;

import lombok.Data;
import nyist.media.entity.ClassRoom;
import nyist.media.enums.RoomType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : dcf
 * @date : 2019/3/15
 */

@Data
public class ClassRoomVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 教室展示图片
     */
    private List<String> imgs = new ArrayList<>();

    /**
     * 教室编号
     */
    private String roomNo;

    /**
     * 教室类型
     */
    private String type;

    /**
     * 教室地址
     */
    private String address;

    /**
     * 教室容纳人数
     */
    private Integer capacity;

    /**
     * 可用状态 false 未使用 true 已使用
     */
    private String status;

    /**
     * 备注
     */
    private String remark;

    /**
     * 展示图
     */
    private String imgUrl;

    public ClassRoomVO(ClassRoom classRoom) {
        this.id = classRoom.getId();
        this.address = classRoom.getAddress();
        this.capacity = classRoom.getCapacity();
        this.imgUrl = classRoom.getImgs().isEmpty() ? "" : classRoom.getImgs().get(0);
        this.status = classRoom.getStatus() ? "已使用" : "未使用";
        this.roomNo = classRoom.getRoomNo();
        if (classRoom.getType().equals(RoomType.Laboratory)) {
            this.type = "实验室";
        } else if (classRoom.getType().equals(RoomType.MULTI_MEDIA)) {
            this.type = "多媒体教室";
        } else if (classRoom.getType().equals(RoomType.MEETING_ROOM)) {
            this.type = "会议室";
        } else if (classRoom.getType().equals(RoomType.MUSIC_ROOM)) {
            this.type = "音乐教室";
        } else if (classRoom.getType().equals(RoomType.STYDY_ROOM)) {
            this.type = "自习室";
        }
    }
}

